package com.dhj.methodsTest;

import com.dhj.streamTest.entity.Author;

import java.util.List;

import static com.dhj.streamTest.entity.AuthorList.getAuthors;

public class Demo6 {

    public static void main(String[] args) {

        List<Author> authors = getAuthors();
        authors.stream()
                .map(author -> author.getAge())
                .map(age -> age + 10)
                .filter(age -> age > 18)
                .map(age -> age + 2)
                .forEach(System.out::println);

        authors.stream()
                .mapToInt(author -> author.getAge())
                .map(age -> age + 10)
                .filter(age -> age > 18)
                .map(age -> age + 2)
                .forEach(System.out::println);

    }

}
